|
|
|
|
|
|
|
users this same ability. When the toolbar's AllowCustomize property is set to True, users can double-click anywhere on the toolbar to add, remove, or relocate buttons through the Customize Toolbar dialog box (see Figure 4.9). |
|
|
|
|
|
|
|
|
Figure 4.9.
Customizing the toolbar is easy when using the built-in Customize
Toolbar dialog box. |
|
|
|
|
|
|
|
|
You don't need to write additional code for this capability. The only code you need is the code for each button; Visual Basic takes care of the rest. |
|
|
|
|
|
|
|
|
The only thing that you must remember with the customize feature is that, unless you save the custom settings somehow, the toolbar will revert to the default view the next time the application is started. Fortunately, Visual Basic provides a way to save and retrieve these changes by using the following methods of the Toolbar control: |
|
|
|
|
|
|
|
|
At runtime, the SaveToolbar method saves the state of the toolbar in the Windows 95 Registry file. |
|
|
|
|
|
|
|
|
The RestoreToolbar method retrieves and restores the toolbar to its customized state. |
|
|
|
|
|
|
|
|
Both have the same syntax, which follows (Table 4.2 explains the settings): |
|
|
|
|
|
|
|
|
Object.<Save¦Restore>Toolbar (key As String, subkey As String, value As _ String) |
|
|
|
|
| TABLE 4.2. REQUIRED Save ANDRestoreTOOLBAR SETTINGS. | | Setting | Description | | Object | The name of the related Toolbar control | | key | A string that specifies the key used in the Registry when saving or retrieving toolbar information | | subkey | A string that can be used as a secondary value under the key value in the Registry | | value | A string that identifies the value under the subkey setting in the Registry file |
|
|
|